package cards.templates;

import cards.Card;
import cards.CardType;
import cards.params.CommonParams;

public class CardWithFreeTrips extends Card {

	private int freeTrips=0;
	
	@Override
	public boolean check() {
		return (freeTrips>0)?freeTrips-->0:false;
	}
	
	public int getFreeTrips() {
		return freeTrips;
	}

	@Override
	public Card newInstance(CardType type) {
		CardWithFreeTrips newcard = new CardWithFreeTrips();
		CommonParams params = (CommonParams)type.getParams();
		newcard.freeTrips = params.getFreeTrips();
		return newcard;
	}
	
	public String toString() {
		return super.toString()+" freeTrips: "+freeTrips;
	}
}
